deploy: only set aboot/abootcfg when found
authorRicardo Salveti <ricardo@foundries.io>
Tue, 15 Apr 2025 23:28:33 +0000 (20:28 -0300)
committerRicardo Salveti <ricardo@foundries.io>
Wed, 30 Apr 2025 16:27:10 +0000 (13:27 -0300)
Bootloader entry should only have aboot and abootcfg configuration
entries when aboot.img is found on the system (e.g.
/usr/lib/modules/$kver).

Otherwise it will be always set, won't be used during boot and
systemd-boot will complain about unknown lines.

Tested-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
src/libostree/ostree-sysroot-deploy.c

index 49168d4f170395aa313cf3cc0ba1dd180c7cd784..45445918c97967ecd4a5f5ccae3f85317752d617 100644 (file)
@@ -2114,17 +2114,10 @@ install_deployment_kernel (OstreeSysroot *sysroot, int new_bootversion,
     {
       g_autofree char *aboot_relpath = g_strconcat ("/", bootcsumdir, "/", aboot_fn, NULL);
       ostree_bootconfig_parser_set (bootconfig, "aboot", aboot_relpath);
-    }
-  else
-    {
-      g_autofree char *aboot_relpath
-          = g_strconcat ("/", deployment_dirpath, "/usr/lib/ostree-boot/aboot.img", NULL);
-      ostree_bootconfig_parser_set (bootconfig, "aboot", aboot_relpath);
-    }
 
-  g_autofree char *abootcfg_relpath
-      = g_strconcat ("/", deployment_dirpath, "/usr/lib/ostree-boot/aboot.cfg", NULL);
-  ostree_bootconfig_parser_set (bootconfig, "abootcfg", abootcfg_relpath);
+      g_autofree char *abootcfg_relpath = g_strconcat ("/", bootcsumdir, "/aboot.cfg", NULL);
+      ostree_bootconfig_parser_set (bootconfig, "abootcfg", abootcfg_relpath);
+    }
 
   if (kernel_layout->devicetree_namever)
     {